home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 112_01.zip / ANYDISK.DOC < prev    next >
Text File  |  1993-06-19  |  7KB  |  273 lines

  1. .so roff.mac
  2. .rm -5
  3. .cm Documentation for anydisk.c
  4. .cm Source:  anydisk.doc
  5. .he 'ANYDISK''July 27, 1982'
  6. .fo ''-#-''
  7.  
  8. .section
  9. The authors
  10.  
  11. .pp
  12. The original version of this program was written by
  13. Richard Damon.
  14. Robert Ward rewrote the program and called it DDNDISK.
  15. Edward K. Ream further modified DDNDISK to produce ANYDISK.
  16. Please send all reports of bugs to:
  17.  
  18.     Edward K. Ream
  19.     1850 Summit Ave.  
  20.     Madison, WI 53705
  21.     (608) 231 - 2952
  22.  
  23.  
  24. .section
  25. The commands
  26.  
  27. .pp
  28. This program allows the operator to examine and modify
  29. a CP/M disk.  
  30. The commands available are:
  31.  
  32. .in +4
  33. .de point
  34. .br
  35. .ti -4
  36. .en
  37. .point
  38. Bn  Set current track and sector to point at block n and
  39. enter block mode.  
  40. .point
  41. Cn  Fill buffer with SIGNED value n.  
  42. .point
  43. Dn  Set current disk number to n (0--# of drives-1) and
  44. print disk information.  
  45. .point
  46. Ea n n ... n    Edit buffer starting from location a.
  47. .point
  48. Fn  Fill buffer with UNSIGNED value n.  
  49. .point
  50. H   Print help message.  
  51. .point
  52. I   Convert block to track and sector and enter sector mode.  
  53. .point
  54. M   Print the directory and the disk allocation map.  
  55. .point
  56. N   Go to next block or track/sector.  
  57. .point
  58. P   Print contents of buffer.
  59. .point
  60. R   Read sector or block into buffer (depending on mode).  
  61. .point
  62. Sn  Set current sector to n (0--# of sectors per track-1)
  63. and enter sector mode.  
  64. .point
  65. Tn  Set current track to n  (0--# of tracks  per disk-1)
  66. and enter sector mode.  
  67. .point
  68. W   Write sector or block from buffer (depending on mode).  
  69. .point
  70. X   Exit program.  
  71. .br
  72. .in -4
  73.  
  74. Notes:
  75. .list
  76. .item
  77. Multiple commands may be specified on a line except
  78. for the X command which must be the only command on
  79. the line.  
  80. .item
  81. Commands may be in upper or lower case letters.  
  82. .item
  83. Spaces are ignored except in the E command where they
  84. are used as separaters for the numbers.  
  85. .endlist
  86.  
  87. Typical commands:
  88.  
  89. d0t0s1rp    read in the track 0 sector 1 of
  90.         disk 0 (drive A) and print it.  
  91.  
  92. e1A 4F        set buffer location 1A to 4F and
  93.         set buffer location 1B to 20.  
  94.  
  95. e0a 00w        set buffer location 0a to 0 and write
  96.         buffer.  Note no space after last data byte.  
  97.  
  98. b0rp        print the entire first block.  
  99.  
  100. b0irp        print the first sector of the first block.  
  101.  
  102.  
  103. .section
  104. The disk allocation map
  105.  
  106. .pp
  107. The M command prints the directory in two sections.  
  108. Section 1 is a listing of each directory entry.  
  109. For instance, entry 15 in the directory would be listed as:
  110.  
  111.     15 = DDNDISK C:0
  112.  
  113. The equal sign means the entry is valid.  
  114. A star (*) would
  115. be printed instead of the equal sign if the entry were deleted.  
  116. The number following the colon is the extent number.  
  117.  
  118. .pp
  119. The second section is a disk allocation map.  
  120. There is one entry in this map for every block on the disk.  
  121. If the block
  122. is not allocated to any file, the characters "..." appear.
  123. Otherwise, a number appears.  
  124. This number refers to the
  125. number of the directory entry which allocated the block.  
  126. Refer back to section 1 to see which file allocated the block.  
  127.  
  128.  
  129. .section
  130. The structure of a CP/M 2.x disk
  131.  
  132. .pp
  133. Here is a brief description of the CP/M 2.x disk format.
  134. Several tracks are typically reserved for the bootstrap and
  135. a copy of CCP and BDOS.  
  136. The number of reserved tracks is
  137. determined by BIOS for each type of disk.  
  138. This number is
  139. called the track offset; it is printed by the 'D' command
  140. when a disk is selected.  
  141.  
  142. .pp
  143. Most commands deal with the track offset automatically.  
  144. The only exception is the 'T' command.  
  145. When using the
  146. 'T' command, you must add the offset yourself.  
  147. Thus, you can access ANY track with the 'T' command.  
  148.  
  149. .pp
  150. Tracks following the reserved tracks store data.  
  151. To speed up disk access, CP/M does not store data in
  152. consecutive sectors.  
  153. The sector translate table converts
  154. from logically consecutive sectors to the order that those
  155. sectors are actually stored on the disk.  
  156. (This table is used only on CP/M 2.x versions.)
  157.  
  158. .pp
  159. All commands deal with LOGICAL sector numbers.  
  160. This is what you almost always want.  
  161. Whenever a sector is printed,
  162. both the logical and physical sector numbers are shown.  
  163. Thus, if you can find any physical sector if you must.  
  164.  
  165. .pp
  166. A block is the smallest unit of a disk which can be
  167. allocated to a file.  
  168. The size of a block is a multiple of 128 bytes.  
  169. The block size is determined by BIOS for each type of disk.  
  170. The block size is printed by the 'D' command.  
  171.  
  172. .pp
  173. Several blocks are reserved at the beginning of the disk
  174. for the directory.  
  175. Again, the number of reserved blocks is 
  176. determined by BIOS for each type of disk.  
  177. This number is
  178. also printed by the 'D' command.  
  179.  
  180. .pp
  181. The format of each entry of the directory is as follows.  
  182. Each entry describes one extent of a file.  
  183.  
  184. .ne 8
  185. .nf
  186. byte   0    : file code : 0 if file exists, 0xe5 if deleted
  187. bytes  1- 8 : file name : file name (ascii)
  188. bytes  9-11 : file type : file type (ascii)
  189. byte   12   : file ext  : extent number (binary)
  190. bytes  13,14: unused
  191. bytes  15   : rec count : count of number of sectors in extent
  192. bytes  16-31: map       : list of blocks used by this extent
  193. .br
  194. .fi
  195.  
  196. .pp
  197. Please note that byte 15 is NOT a reliable guide to the
  198. number of blocks allocated to a file.  
  199. The way to tell is
  200. simply to count the blocks in the map.  
  201. Block 0 is never
  202. allocated to any file and it signals the end of the map.  
  203. Remember that block numbers take either 1 or 2 bytes depending
  204. on whether there are less than 256 blocks or not.  
  205.  
  206.  
  207. .section
  208. Differences between DDNDISK and ANYDISK
  209.  
  210. .bulletlist
  211. .bullet
  212. ANYDISK uses the CP/M 2.x BIOS select disk routine
  213. to get the characteristics of the disk dynamically.  
  214. Thus, different
  215. .ul
  216. kinds
  217. of disks may be used without
  218. recompiling the program.  
  219.  
  220. .bullet
  221. ANYDISK will work even with hard disks.  
  222. Several arithmetic statements have been converted into
  223. loops in order to avoid overflow problems.  
  224. This also means that a single index variable can NOT be used.  
  225. Instead,  the current block, track and sector
  226. numbers are maintained separately.  
  227.  
  228. .bullet
  229. The code that computes the disk map now needs lots
  230. less memory.  
  231. Only one disk block at a time is now loaded into memory.  
  232.  
  233. .bullet
  234. The disk map now is more readable.  
  235. The format is useful
  236. even for hard disks.  
  237. Directory entries which have
  238. 0xe5 for a file name are completely ignored.  
  239.  
  240. .bullet
  241. The 'D' command now prints a summary of the characteristics
  242. of the selected disk.  
  243.  
  244. .bullet
  245. The 'H' command is new.  
  246. It prints a help message.  
  247.  
  248. .bullet
  249. The 'I' command is now useful for printing parts of a block.  
  250. For example, to print just the 5'th record of block 20 use:
  251.  
  252.     b20i nnnn rp
  253.  
  254. .bullet
  255. The 'W' command now tells BIOS that all writes are to
  256. the directory.  
  257. This forces BIOS to do the write at once.  
  258.  
  259. .bullet
  260. You get a more informative prompt if you type a value
  261. which is out of range.  
  262.  
  263. .bullet
  264. The ptmap routine contains two constants, M1COL and M2COL
  265. which control how many entries will be put on each line
  266. for the directory list and the disk allocation map.  
  267. I use fairly small values because my screen only has
  268. 64 columns.  
  269. Choose the constants you like best.
  270. k allocation map.  
  271. I use fairly small values because my screen only has
  272. 64 columns.  
  273. Choose the constants y